package recursion;

//0,1,1,2,3,5,8,13,21
//
//f(n) = f(n-1) + f(n-2)
//f(1) = 0
//f(2) = 1

//j(n) = n * j(n-1)
//j(1) = 1

public class Jiecheng {
	
	public static int fbnq(int n) {
		if(n<=1)return 0;
		if(n==2)return 1;
		return fbnq(n-1) + fbnq(n-2);
	}

	public static void main(String[] args) {
		System.out.println("1:" + t(1));
		System.out.println("2:" + t(2));
		System.out.println("3:" + t(3));
		System.out.println("8:" + t(8));

	}
	
	public static int jiecheng(int n) {
		if (n==1) return 1;
		return n * jiecheng(n-1);
	}
	
	//t(1)=1
	//t(2)=2
	//t(n) = t(n-1) + t(n-2)
	public static int t(int n) {
		if(n == 1) return 1;
		if(n == 2) return 2;
		return t(n-1) + t(n-2);
	}

}
